<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>后台管理中心</title>
{$system_css}
{$system_js}
<script>
var editor;
KindEditor.ready(function(K) {
   editor = K.create('textarea[name="content"]', {
	allowFileManager : true
    });  
});


$(function(){
                
$("#myform").validate({
		rules: {
			name: "required",
			category_id: "required"
		},
		messages: {
			name: "新闻标题不能为空",
			category_id: "分类不能为空"
		}
	});
})
</script>
</head>
<body>
{include file="message.html"}
<div class="pad-10">
  <div class="common-form">
    <form name="myform" action="#" method="post" id="myform" enctype="MULTIPART/FORM-DATA">
      <fieldset>
        <legend>基本信息</legend>
        <table width="100%" class="table_form">
          <tr>
            <td width="80">新闻名称</td>
            <td><input type="text" name="name"  class="input-text" id="name" size="50"/>
              <input type="text" name="color"  class="input-text color" id="color" size="10">
              </input>
              <input id="bn" type="button" value="选色" /></td>
          </tr>
          <tr>
            <td width="80">推荐类型</td>
            <td>
            
            {$checkboxs}
            
            </td>
          </tr>
          <tr>
            <td>新闻分类</td>
            <td id="category_id_select"><select name="category_id" class="category_id">
                <option value="">==不选择==</option>
                
                                        {$category_option}
                                    
              </select>
              &nbsp; </td>
          </tr>
          <tr>
            <td>地区</td>
            <td id="area_category_id"><select name="area_category_id" class="area_category_id">
                <option value="0">==不选择==</option>
                
                                        {$area_option}
                                    
              </select>
              &nbsp; </td>
          </tr>
          <tr>
            <td width="80">作者</td>
            <td><input type="text" name="author"  class="input-text" id="author" size="50">
              </input></td>
          </tr>
          <tr>
            <td width="80">来源</td>
            <td><input type="text" name="source"  class="input-text" id="source" size="50">
              </input></td>
          </tr>
          <tr>
            <td width="80">URL</td>
            <td><input type="text" name="url"  class="input-text" id="url" size="50">
              </input></td>
          </tr>
          <tr>
            <td width="80">封面图片</td>
            <td><input type="file" name="news_images" id="news_images" /></td>
          </tr>
          <tr>
            <td width="80">详细内容</td>
            <td><textarea name="content" id="content" style="width:700px;height:300px;"></textarea></td>
          </tr>
          <tr>
            <td>META Title</td>
            <td><input type="text" name="title"  value="" class="input-text" size="50">
              </input></td>
          </tr>
          <tr>
            <td>META Keywords</td>
            <td><textarea  style="width:50%;height:46px;"  name="keywords"></textarea></td>
          </tr>
          <tr>
            <td>META Description</td>
            <td><textarea  style="width:50%;height:46px;"  name="description"></textarea></td>
          </tr>
          <tr>
            <td width="80"></td>
            <td>排序：
              <input type="text" name="position"  class="input-text" id="position" size="10"/>
              点击数量:
              <input type="text" name="clicks"  class="input-text" id="clicks" size="10"/></td>
          </tr>
          <tr align="center">
            <td colspan="2"><input type="submit" value="提交" name="dosubmit" class="button"></td>
          </tr>
        </table>
      </fieldset>
    </form>
  </div>
</div>
<script>

            $(function(){
                
                
                //颜色插件
                $("#bn").bigColorpicker("color");
                
                $('.area_category_id').change(function(){
                    $(this).next('.area_category_id').remove();
                })
            });
            
            
            function change_category2(category_sub){
                $('.area_category_id').change(function(){
                    $(this).next('.area_category_id').remove();
                })
                $.ajax({
                    url:"{$site_url}admin/ajax/category_sub",
                    type:'post',
                    dataType:'html',
                    data:'id='+category_sub.value,
                    success:function(data){
                        if(data != ''){
                            var html = "<select class='area_category_id' name='area_category_id[]' onchange='change_category2(this)'><option value='0'>==不选择==</option>";
                            html +=data+"</select>";
                            $('#area_category_id').append(html);
                        } else{
                            $(this).next('.area_category_id').remove();
                        }
                    }
                });
            }
        </script>
</body>
</html>